/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package day07;

import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Administrator
 */
public class FileOperator {
  
/*
 * Ghi file
 */    
  public void writeToFile(String fileName) throws FileNotFoundException{ 

      System.out.println("Bat dau ghi file...");
      PrintWriter out = new PrintWriter(fileName);
            for(int i =1; i<=10;i++){
             out.println(i);             
            }
            out.close();
            
        
        System.out.println("Ket thuc ghi file...");
  }  
  public static void main(String[] agrs) throws FileNotFoundException{
   FileOperator fo = new FileOperator();
   fo.writeToFile("demo.txt");
  
  }
    
    
}
